package ThreadTest;

import java.util.concurrent.*;

public class ThreadCallAble {
    public static void main(String[] args) {
        Show show = new Show();

        ExecutorService executorService = Executors.newCachedThreadPool();
        new Runnable() {
            @Override
            public void run() {

            }
        };

        FutureTask futureTask = new FutureTask<>(show);
        FutureTask<Integer> futureTask1 = new FutureTask<Integer>(show);

        Thread thread = new Thread(futureTask);
        thread.start();
        try {
            System.out.println("futureTask.get() = " + futureTask.get());
        } catch (InterruptedException e) {
            e.printStackTrace();
        } catch (ExecutionException e) {
            e.printStackTrace();
        }


    }
}
class Show implements Callable{
    @Override
    public Object call() throws Exception {
        for (int i = 0; i < 10; i++) {
            System.out.println(i);
        }
        return 6;
    }
}
